snippet author_info "作者信息" i
/*-----------------
* author: Rainboy
* email: rainboylvx@qq.com
* time: `date`
*----------------*/
endsnippet

snippet // "行内注释" b
/* ${0} */
endsnippet

snippet in "#include" b
#include <${1:cstdio>}
${0}
endsnippet

snippet main "main()" b
int main(){
    ${0}
    return 0;
}
endsnippet


#freopen stdin
snippet fr "freopen" b
freopen("${1}.in","r",stdin);
${0}
endsnippet

#freopen stdout
snippet fw "freopen stdout" b
freopen("${1}.out","w",stdout);
${0}
endsnippet


#printf 
snippet pr "printf" b
printf("${0}");
endsnippet

#scanf 
snippet sc "scanf" b
scanf("${0}");
endsnippet


# return
snippet "re (\S+)" "return" ir
return `!p snip.rv=match.group(1)`;
endsnippet

#return 0;
snippet re "return 0" i
return;
endsnippet

snippet p_bin "输出对应二进制的函数" b
//输出二进制
void p_bin(int n){
    char a[20];
    char b[20] = {0};
    int idx= 0;
    while(n){
        int t = n & 1;
        a[idx++] = t +'0';
        n = n >>1;
    }
    
    int i;
    for(i=0;i<idx;i++)
        b[i] = a[idx-i-1];

    printf("%s\n",b);

}
endsnippet
